package cn.bellychang.leetcode.question033;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author ChangLiang
 * @date 2021/2/4
 */
class SolutionTest2 {

    private Solution3 solution;

    @BeforeEach
    public void setUp() {
        solution = new Solution3();
    }

    @Test
    @DisplayName("test")
    public void test(){
        int[] nums = new int[]{4,5,6,7,0,1,2};
        assertThat(solution.search(nums, 0)).isEqualTo(4);
    }

    @Test
    @DisplayName("test")
    public void test2(){
        int[] nums = new int[]{4,5,6,7,9,10,0,1,2};
        assertThat(solution.search(nums, 0)).isEqualTo(6);
    }

    @Test
    @DisplayName("test")
    public void test5(){
        int[] nums = new int[]{4,5,6,7,9,10,0,1,2};
        assertThat(solution.search(nums, 10)).isEqualTo(5);
    }

    @Test
    @DisplayName("test")
    public void test3(){
        int[] nums = new int[]{4,5,6,7,0,1,2};
        assertThat(solution.search(nums, 3)).isEqualTo(-1);
    }

    @Test
    @DisplayName("test")
    public void test4(){
        int[] nums = new int[]{1};
        assertThat(solution.search(nums, 0)).isEqualTo(-1);
    }
}